﻿using System;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using IterationLife.Extensions.Dtos;
using Util.Applications;

namespace IterationLife.PlatformBackEnd.AppServices.Dtos.FootballTeachings
{
    /// <summary>
    /// 课程分类数据传输对象
    /// </summary>
    [DataContract]
    public class CourseCategoryDto : DtoBase
    {
        /// <summary>
        /// 初始化课程分类数据传输对象
        /// </summary>
        public CourseCategoryDto()
        {
            Banner = new Resources();
        }

        /// <summary>
        /// 名称
        /// </summary>
        [Required(ErrorMessage = "名称不能为空")]
        [StringLength(50, ErrorMessage = "名称输入过长，不能超过50位")]
        [Display(Name = "名称")]
        [DataMember]
        public string Name { get; set; }

        /// <summary>
        /// 编码
        /// </summary>
        [Required(ErrorMessage = "编码不能为空")]
        [StringLength(50, ErrorMessage = "编码输入过长，不能超过50位")]
        [Display(Name = "编码")]
        [DataMember]
        public string Code { get; set; }

        /// <summary>
        /// 封面图
        /// </summary>
        [Display(Name = "封面图")]
        [DataMember]
        public Resources Banner { get; set; }

        /// <summary>
        /// 启用
        /// </summary>
        [Required(ErrorMessage = "启用不能为空")]
        [Display(Name = "启用")]
        [DataMember]
        public bool Enabled { get; set; }

        /// <summary>
        /// 排序号
        /// </summary>
        [Display(Name = "排序号")]
        [DataMember]
        public int? SortId { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Display(Name = "创建时间")]
        [DataMember]
        public DateTime? CreationTime { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [Display(Name = "创建人")]
        [DataMember]
        public Guid? CreatorId { get; set; }

        /// <summary>
        /// 最后修改时间
        /// </summary>
        [Display(Name = "最后修改时间")]
        [DataMember]
        public DateTime? LastModificationTime { get; set; }

        /// <summary>
        /// 最后修改人
        /// </summary>
        [Display(Name = "最后修改人")]
        [DataMember]
        public Guid? LastModifierId { get; set; }

        /// <summary>
        /// 是否删除
        /// </summary>
        [Required(ErrorMessage = "是否删除不能为空")]
        [Display(Name = "是否删除")]
        [DataMember]
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 版本号
        /// </summary>
        [Display(Name = "版本号")]
        [DataMember]
        public Byte[] Version { get; set; }

        /// <summary>
        /// 输出课程分类状态
        /// </summary>
        public override string ToString()
        {
            return this.ToEntity().ToString();
        }

        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="sortId">排序号</param>
        public CourseCategoryDto Init(int sortId)
        {
            Enabled = true;
            SortId = sortId;
            return this;
        }
        /// <summary>
        /// 排除编号集合
        /// </summary>
        public string ExcludeIds { get; set; }
    }
}
